--------------------------------------------------------------------------------
-- @name: tpack_create_objects.sql
-- @author: dion cho
-- @note: create tpack objects. 
--------------------------------------------------------------------------------

set verify off
set echo off


-- create internal tables for analyzing and reporting

-- create directory for background_dump_dest, user_dump_dest
prompt Creating directory object to retrieve trace file info
col value new_value dir

select value from v$parameter where name = 'user_dump_dest';
create or replace directory tpack_user_dump_dest as '&dir';

select value from v$parameter where name = 'background_dump_dest';
create or replace directory tpack_background_dump_dest as '&dir';

create or replace directory tpack_temp_dir as '&temp_dir';

-- create table and datas
prompt Creating tables and datas for configuration and reporting


-- configuration tables
--drop table tpack_configuration purge;

create table tpack_configuration (
  instance_number   number, -- for RAC
  sys_conn_string   varchar2(1000),
  temp_dir          varchar2(1000),
  sid               varchar2(1000),
  oracle_path       varchar2(4000),
  kill_command_template     varchar2(4000) default '/bin/ps -ef | /bin/grep "%c%" |/bin/grep -v grep | /bin/awk ''{print $2}'' | /usr/bin/xargs /bin/kill -2' -- the unix command to kill process. %c% means command to kill
);

create unique index tpack_configuration_n1 on tpack_configuration(instance_number);

insert into tpack_configuration(instance_number, sys_conn_string, temp_dir, sid, oracle_path)
values(&instance_number, '&conn_string', '&temp_dir', '&sid', '&oracle_path');
commit;



-- types to be used as analysis result

-- create timing info
create or replace type timing_type as object (
  proc_name   varchar2(100),
  csec        number
);
/
show errors

-- create property type
create or replace type property as object ( 
  name      varchar2(100),
  value     clob
);
/
show errors

-- create session type
create or replace type sess_obj as object (
  sid         number,
  serial_no   number,
  spid        varchar2(24),
  program     varchar2(64),
  module      varchar2(48),
  sql_id      varchar2(13),
  child_number  number,
  sql_text    varchar2(1000),
  wait        varchar2(64),
  wait_time   number,
  status      varchar2(8),
  state       varchar2(19)
);
/
show errors

-- create hot block type
create or replace type hot_block as object (
  obj_no    number,
  obj_name  varchar2(64),
  file_no   number,
  block_no  number,
  touch_cnt number
);
/
show errors


-- create session snapshot type 
create or replace type session_snapshot_type as object (
  type          varchar2(10),
  item          varchar2(100),
  start_val     number,
  end_val       number,
  total_delta   number,
  deltas        varchar2(4000)
);
/
show errors


-- create latch profile type ( latch name + latch address + code name + sql id)
-- held_time, avg_held_time = 1/1000 unit
create or replace type latch_prof_type as object (
  sid           number,
  latch_name    varchar2(50),
  latch_addr    raw(4),
  code_name     varchar2(64),
  sql_id        varchar2(13),
  obj_why       varchar2(20),
  held_pct      number,
  held_time     number,
  avg_held_time number
);
/
show errors


-- create wait profile type 
create or replace type wait_prof_type as object (
  sid           number,
  event_name    varchar2(64),
  p1			number,
  p2			number,
  p3			number,
  obj			number,
  wait_pct 		number,
  wait_time		number,
  avg_wait_time	number
);
/
show errors


-- create or replace type heap report type
create or replace type heap_usage_type as object (
  type          varchar2(20),
  heap_name     varchar2(20),
  item          varchar2(20),
  item_count    number,
  item_size     number,
  heap_size     number,
  ratio         number
);
/
show errors


-- create or replace type sga_stat 
create or replace type sga_stat_type as object (
  poolidx   number,
  pool      varchar2(12),
  name      varchar2(26),
  mbytes      number,
  pct       number
);
/
show errors



-- create stack trace profile type 
create or replace type stack_prof_type as object (
--  stack_trace   varchar2(32767),
  stack_trace   clob,
  hit_cnt       number,
  hit_pct       number
);
/
show errors


-- create function description type
create or replace type func_desc_type as object (
  prefix        varchar2(150),
  category      varchar2(30),
  description   varchar2(1000)
);
/
show errors


-- create oerr type
create or replace type oerr_type as object (
  err_code      varchar2(5),
  message       varchar2(1000),
  texts         clob
);
/
show errors


-- create active_sql type
create or replace type active_sql as object (
  sid           number,
  sql_id        varchar2(13),
  sql_text      varchar2(1000)
);
/
show errors

-- create sql type
create or replace type sql_type as object (
  sql_id        varchar2(13),
  child_no      number,
  sql_text      varchar2(1000)
);
/
show errors

-- create bind value type
create or replace type bind_type as object (
  bind_name       varchar2(30),
  bind_type       varchar2(15),
  bind_value      varchar2(4000)
);
/
show errors



-- global temporary table for storing call stack analysis.
--drop table tpack_call_stack purge;

create global temporary table tpack_call_stack(seq number, idx number, fname varchar2(1000), par_fname varchar2(1000))
on commit preserve rows;

create index tpack_call_stack_n1 on tpack_call_stack(seq, idx);

--drop table tpack_call_stack_sum purge;

create global temporary table tpack_call_stack_sum(stack_trace clob, hit_cnt number, hit_ratio number)
on commit preserve rows;


-- global temporary table for storing snapshot
--drop table tpack_snapshot purge;

create global temporary table tpack_snapshot (
  sid           number,
  snapshot_idx  number,
  type          varchar2(10),
  item          varchar2(100),
  value         number
) on commit preserve rows
;

create index tpack_snapshot_n1 on tpack_snapshot(snapshot_idx, type, item);


-- global temporary table for storing sga stat from trace file
-- drop table tpack_sga_stat purge;

create global temporary table tpack_sga_stat (
  ksmdsidx        number, -- pool idx
  ksmssnam        varchar2(26), -- allocatio name
  ksmsslen        number -- bytes
) on commit preserve rows;


-- global temporary table for storing heap dump analysis.
--drop table tpack_heap_dump purge;

create global temporary table tpack_heap_dump(
--create table tpack_heap_dump (
  heap_addr       varchar2(20),
  par_heap_addr   varchar2(20),
  heap_name       varchar2(20),
  chunk_type      varchar2(20),
  obj_type        varchar2(20),
  subheap         varchar2(20),
  chunk_size      number
) on commit preserve rows;


--drop table tpack_heap_dump_sum purge;

create global temporary table tpack_heap_dump_sum (
--create table tpack_heap_dump_sum (
  heap_addr       varchar2(20),
  par_heap_addr   varchar2(20),
  heap_name       varchar2(20),
  chunk_type      varchar2(20),
  obj_type        varchar2(20),
  subheap         varchar2(20),
  chunk_cnt       number,
  chunk_size      number
) on commit preserve rows;


-- global temporary table for storing wait profile
-- drop table tpack_wait_event purge;

create global temporary table tpack_wait_event (
	event		varchar2(64),
	p1			number,
	p2			number,
	p3			number,
	obj			number,   -- for wait_file_report only
	ela			number
) on commit preserve rows;



-- table to store the result of the generic varchar2 result report
-- drop table tpack_result_varchar2 purge;

create table tpack_result_varchar2 (
  job_id        varchar2(50),
  seq           number,
  result        varchar2(4000)
);

create index tpack_result_varchar2_n1 on tpack_result_varchar2(job_id);

-- table to store the result of the property 
-- drop table tpack_result_property purge;

create table tpack_result_property (
  job_id        varchar2(50),
  seq           number,
  result        property
);

create index tpack_result_property_n1 on tpack_result_property(job_id);


-- table to store the result of the session snapshot report
-- drop table tpack_result_session_snapshot purge;
create table tpack_result_session_snapshot (
  job_id        varchar2(50),
  seq           number,
  result        session_snapshot_type
);

create index tpack_result_sess_snapshot_n1 on tpack_result_session_snapshot(job_id);



-- table to store the result of the latch profile report
-- drop table tpack_result_latch_prof purge;

create table tpack_result_latch_prof (
  job_id        varchar2(50),
  seq           number,
  result        latch_prof_type
);

create index tpack_result_latch_prof_n1 on tpack_result_latch_prof(job_id);


-- table to store the result of the wait profile report
-- drop table tpack_result_wait_prof purge;

create table tpack_result_wait_prof (
  job_id        varchar2(50),
  seq           number,
  result        wait_prof_type
);

create index tpack_result_wait_prof_n1 on tpack_result_wait_prof(job_id);



-- table to store the result of the heap dump analysis result
-- drop table tpack_result_heap_dump  purge;

create table tpack_result_heap_dump (
  job_id        varchar2(50),
  seq           number,
  result        heap_usage_type
);

create index tpack_result_heap_dump_n1 on tpack_result_heap_dump(job_id);


-- table to store the result of the sga stat analysis result
-- drop table tpack_result_sga_stat purge;

create table tpack_result_sga_stat (
  job_id        varchar2(50),
  seq           number,
  result        sga_stat_type
);

create index tpack_result_sga_stat_n1 on tpack_result_sga_stat(job_id);


-- table to store the result of the stack profile result
-- drop table tpack_result_stack_prof purge;

create table tpack_result_stack_prof (
  job_id        varchar2(50),
  seq           number,
  result        stack_prof_type
);

create index tpack_result_stack_prof_n1 on tpack_result_stack_prof(job_id);



-- create tpack_server related objects. only used for enterprise edition

-- drop table tpack_server_control purge;

create table tpack_server_control (
    instance_number number, -- same as tpack_configuration.instance_number. for RAC 
    flag    varchar2(100),  -- RUNNING, STOPPED, STOP REQEUSTED, RUNNING REQUESTED
    debug   varchar2(10) default 'BASIC', -- BASIC, DETAIL 
    max_concur_job    number default 5, -- max concrrent job count
    wakeup_interval   number default 5, -- how frequently to be awakend and capture session status
    job_no    number   -- dbms_job job no for server process
);

insert into tpack_server_control(instance_number, flag) values(&instance_number, 'STOPPED');
commit;


-- drop table tpack_report_templates purge;

create table tpack_report_templates (
  seq             number,
  custom          varchar2(1),  -- Y = custom, N = embedded
  report_type     varchar2(100),
  procedure_name  varchar2(100)
);

alter table tpack_report_templates add constraint tpack_report_templates_c1 unique(seq);
alter table tpack_report_templates add constraint tpack_report_templates_c2 unique(report_type);
alter table tpack_report_templates add constraint tpack_report_templates_c3 unique(procedure_name);

--drop sequence tpack_report_type_seq;
create sequence tpack_report_type_seq;

begin
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Session Detail', 'tpack.session_detail');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'SQL Detail', 'tpack.sql_detail');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Session Snapshot', 'tpack.session_snapshot_report');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Latch Profile', 'tpack.latch_profile_report');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'System Call', 'tpack.system_call_report');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Diag Trace', 'tpack.get_diag_trace');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Dump', 'tpack.get_dump');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Process Dump', 'tpack.process_dump');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'System Dump', 'tpack.system_dump');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Error Dump', 'tpack.error_dump');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Hang Analyze', 'tpack.hang_analyze');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Heap Dump', 'tpack.heap_dump');  
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Callstack Profile', 'tpack.callstack_prof_report');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'Heap Report', 'tpack.heap_report');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'SGA Heap Report', 'tpack.sga_heap_report');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'PGA Heap Report', 'tpack.pga_heap_report');
  insert into tpack_report_templates values(tpack_report_type_seq.nextval, 'N', 'SGA Stat', 'tpack.sga_stat');
  commit;
end;
/

drop sequence tpack_report_type_seq;

create or replace type report_template_type as object (
  report_type     varchar2(100),
  procedure_name  varchar2(100)
);
/
show errors


-- drop table tpack_report_param_templates purge;

create table tpack_report_param_templates (
  report_type     varchar2(100),
  seq             number,
  param_name      varchar2(100),
  param_type      varchar2(100),
  def_value       varchar2(100)
);

create index tpack_report_param_templ_n1 on tpack_report_param_templates(report_type);

begin
  -- session detail params
  insert into tpack_report_param_templates values('Session Detail', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Session Detail', 2, 'b_include_plan', 'number', 0);
  insert into tpack_report_param_templates values('Session Detail', 3, 'plan_option', 'varchar2', 'typical');
  
  -- SQL detail params
  insert into tpack_report_param_templates values('SQL Detail', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('SQL Detail', 2, 'sql_id', 'varchar2', null);
  insert into tpack_report_param_templates values('SQL Detail', 3, 'child_number', 'number', 0);
  insert into tpack_report_param_templates values('SQL Detail', 4, 'options', 'varchar2', 'all');
  
  
  -- session snapshot params
  insert into tpack_report_param_templates values('Session Snapshot', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Session Snapshot', 2, 'snapshot_count', 'number', null);
  insert into tpack_report_param_templates values('Session Snapshot', 3, 'sleep_time', 'number', null);
  insert into tpack_report_param_templates values('Session Snapshot', 4, 'include_sys_level', 'number', 0);
  
  -- latch profile params
  insert into tpack_report_param_templates values('Latch Profile', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Latch Profile', 2, 'profile_data', 'list', 'LATCH_NAME, CODE_NAME');
  insert into tpack_report_param_templates values('Latch Profile', 3, 'latch_filter', 'varchar2', null);
  insert into tpack_report_param_templates values('Latch Profile', 4, 'prof_duration', 'number', 5);
  insert into tpack_report_param_templates values('Latch Profile', 5, 'sleep_time', 'number', 0);
  
  -- system call params
  insert into tpack_report_param_templates values('System Call', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('System Call', 2, 'duration', 'number', 1);
  insert into tpack_report_param_templates values('System Call', 3, 'format', 'varchar2', 'DETAIL');
  
  -- diag trace params
  insert into tpack_report_param_templates values('Diag Trace', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Diag Trace', 2, 'event_no', 'number', 10046);
  insert into tpack_report_param_templates values('Diag Trace', 3, 'event_level', 'number', 1);
  insert into tpack_report_param_templates values('Diag Trace', 4, 'trace_count', 'number', 1);
  insert into tpack_report_param_templates values('Diag Trace', 5, 'sleep_time', 'number', 10);
  insert into tpack_report_param_templates values('Diag Trace', 6, 'result', 'list', 'TKPROF');
  
  -- dump
  insert into tpack_report_param_templates values('Dump', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Dump', 2, 'dump_name', 'varchar2', null);
  insert into tpack_report_param_templates values('Dump', 3, 'dump_level', 'number', 1);
  insert into tpack_report_param_templates values('Dump', 4, 'get_whole_contents', 'number', 1);
	
  -- process dump
  insert into tpack_report_param_templates values('Process Dump', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Process Dump', 2, 'dump_level', 'number', 10);
  insert into tpack_report_param_templates values('Process Dump', 3, 'get_whole_contents', 'number', 1);
  
  -- system dump
  insert into tpack_report_param_templates values('System Dump', 1, 'dump_level', 'number', 10);
  insert into tpack_report_param_templates values('System Dump', 2, 'get_whole_contents', 'number', 1);
  
  
  -- error dump
  insert into tpack_report_param_templates values('Error Dump', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Error Dump', 2, 'dump_level', 'number', 3);
  insert into tpack_report_param_templates values('Error Dump', 3, 'get_whole_contents', 'number', 1);
  
  -- hang analyze
  insert into tpack_report_param_templates values('Hang Analyze', 1, 'dump_level', 'number', 10);
  insert into tpack_report_param_templates values('Hang Analyze', 2, 'is_cluster', 'number', 0);
  insert into tpack_report_param_templates values('Hang Analyze', 3, 'get_whole_contents', 'number', 1);
  
  
  -- heap dump
  insert into tpack_report_param_templates values('Heap Dump', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Heap Dump', 2, 'dump_level', 'varchar2', '1');
  insert into tpack_report_param_templates values('Heap Dump', 3, 'get_whole_contents', 'number', 1);
  
  
  -- callstack profile
  insert into tpack_report_param_templates values('Callstack Profile', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Callstack Profile', 2, 'duration', 'number', 1);
  insert into tpack_report_param_templates values('Callstack Profile', 3, 'sleep_time', 'number', 0.1);
  insert into tpack_report_param_templates values('Callstack Profile', 4, 'max_call_depth', 'number', 300);
  insert into tpack_report_param_templates values('Callstack Profile', 5, 'delimitor', 'varchar2', '->');
  insert into tpack_report_param_templates values('Callstack Profile', 6, 'tree_like_format', 'number', 1);
  
  -- heap analysis
  insert into tpack_report_param_templates values('Heap Report', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('Heap Report', 2, 'dump_level', 'varchar2', '0x20000001');
  
  -- sga heap analysis
  insert into tpack_report_param_templates values('SGA Heap Report', 1, 'subheap_depth', 'number', 0);
  
  -- pga heap analysis
  insert into tpack_report_param_templates values('PGA Heap Report', 1, 'session_id', 'number', null);
  insert into tpack_report_param_templates values('PGA Heap Report', 1, 'subheap_depth', 'number', 0);
  
  -- extended sga stat
  insert into tpack_report_param_templates values('SGA Stat', 1, 'pool', 'varchar2', 'shared pool');
  
  commit;
end;
/


create or replace type report_param_template_type as object (
  param_name      varchar2(100),
  param_type      varchar2(100),
  def_value       varchar2(100)
);
/
show errors


-- drop table tpack_report_param_lists purge;

create table tpack_report_param_lists (
  report_type    varchar2(100),
  param_name     varchar2(100),
  seq            number,
  value          varchar2(1000)
);

create index tpack_report_param_lists_n1 on tpack_report_param_lists(report_type);

insert into tpack_report_param_lists values('Latch Profile', 'profile_data', 1, 'LATCH_NAME, CODE_NAME');
insert into tpack_report_param_lists values('Latch Profile', 'profile_data', 2, 'LATCH_NAME, LATCH_ADDR, CODE_NAME');
insert into tpack_report_param_lists values('Latch Profile', 'profile_data', 3, 'LATCH_NAME, LATCH_ADDR, CODE_NAME, SQL_ID');
commit;


create or replace type report_param_list_type as object (
  param_name     varchar2(100),
  seq            number,
  value          varchar2(1000)
);
/

show errors


-- drop table tpack_reports purge;

create table tpack_reports (
  instance_number number,
  report_id     varchar2(20),
  report_type   varchar2(100),
  create_time   date default sysdate,
  registered    varchar2(3),   -- YES or NO
  occurrence    number default 1, -- how many times to executed? null = infinitively
  delay_time    number default 1,  -- how long to delay for each execution?
  start_time    date default sysdate, -- when the report to be started?
  is_enabled    number default 1, -- is report enabled?
  exec_count    number default 0, -- total successful exec count. this should be < occurrence
  last_exec_time  date  -- when the last execution occurred?
);


create index tpack_reports_n1 on tpack_reports(report_id);


create or replace type active_report_job_type as object (
  job_id        varchar2(50),
  report_id     varchar2(20),
  session_id    number
);
/
show errors


-- drop table tpack_report_params purge;

create table tpack_report_params (
  report_id     varchar2(20),
  param_name    varchar2(64),
  param_value   varchar2(1000)
);


create index tpack_report_params_n1 on tpack_report_params(report_id);

-- drop table tpack_report_conditions purge;

create table tpack_report_conditions (
  report_id     varchar2(20),
  type          varchar2(10),
  name          varchar2(64),
  value         varchar2(1000),
  measure       varchar2(10)  -- DELTA or SUM
);

create index tpack_report_conditions_n1 on tpack_report_conditions(report_id);


-- drop table tpack_report_job_hist purge;

create table tpack_report_job_hist (
  report_id     varchar2(20),
  job_id        varchar2(50),
  start_time    date,
  end_time      date,
  status        varchar2(10), -- STARTED, SUCCESS, FAIL
  err_no        number,
  err_msg       varchar2(4000)
);


create index tpack_report_job_hist_n1 on tpack_report_job_hist(report_id, job_id);
create index tpack_report_job_hist_n2 on tpack_report_job_hist(job_id);


-- global temporary table for store internal session tracking data
-- drop table tpack_report_session_temp purge;

create global temporary table tpack_report_session_temp (
  seq         number,
  report_id   varchar2(20),
  sid         number,
  type        varchar2(10),
  name        varchar2(64),
  --value       varchar2(1000),
  value       number,
  measure     varchar2(10),
  cond_value  varchar2(1000),
  procedure_name    varchar2(100)
) on commit preserve rows;

create index tpack_report_session_temp_n1 on tpack_report_session_temp(sid);


-- helper table to show function name description
--drop table tpack_function_names purge;

create table tpack_function_names (
  prefix    varchar2(150),
  category  varchar2(30),
  description varchar2(1000)
);

-- from doc# 175982.1
begin
  insert into tpack_function_names values('ain', 'ram/index', 'alter index');
  insert into tpack_function_names values('ainp', 'ram/index', 'alter index partition management operation');
  insert into tpack_function_names values('apacb', 'optim/rbo', 'used by optimizer in connect by processing');
  insert into tpack_function_names values('atb atbi', 'dict/sqlddl', 'alter table');
  insert into tpack_function_names values('ctc ctci cvw', 'dict/sqlddl', 'create table (IOT) or cluster operations as well as create view related operations (with constraint handling functionality)');
  insert into tpack_function_names values('ddfnet', 'progint/distrib', 'various distributed operations on remote dictionary');
  insert into tpack_function_names values('delexe', 'sqlexec/dmldrv', 'manages the delete statement operation');
  insert into tpack_function_names values('dix', 'ram/index', 'manages drop index or validate index operation');
  insert into tpack_function_names values('dtb', 'dict/sqlddl', 'manages drop table operation');
  insert into tpack_function_names values('evaa2g evah2p evaa2g expgon', 'dbproc/sqlfunc', 'various functions involves in evaluating operand outcomes such as   addition , average, OR operator, bites AND , bites OR, concatenation, as well as Oracle related functions   count(), dump() , etc. The list is extensive.');
  insert into tpack_function_names values('gra', 'security/dac manages', 'the granting and revoking of privilege rights to a user');
  insert into tpack_function_names values('gslcsq', 'plsldap', 'support for operations with an LDAP server');
  insert into tpack_function_names values('insexe', 'sqlexec/dmldrv', 'handles the insert statement operation');
  insert into tpack_function_names values('jox', 'progint/opi', 'functionality associated with the Java compiler and with the Java runtime environment within the Server');
  insert into tpack_function_names values('k2c k2d', 'progint/distrib', 'support for database to database operation in distributed environements as well as providing, with respect to the 2-phase commit protocol, a globally unique Database id');
  insert into tpack_function_names values('k2g k21', 'txn/disttx', 'support for the 2 phase commit protocol protocol and the coordination of the various states in managing the distributed transaction');
  insert into tpack_function_names values('k2r', 'progint/distrib', 'user interface for managing distributed transactions and combining distributed results');
  insert into tpack_function_names values('k2s', 'progint/distrib', 'handles logging on, starting a transaction, ending a transaction and recovering a transaction');
  insert into tpack_function_names values('k2sp', 'progint/distrib', 'k2sp - management of savepoints in a distributed environment');
  insert into tpack_function_names values('k2v', 'txn/disttx', 'handles distributed recovery operation');
  insert into tpack_function_names values('kad', 'cartserv/picklercs', 'handles OCIAnyData implementation');  
  insert into tpack_function_names values('kau', 'ram/data', 'manages the modification of indexes for inserts, updates and delete operations for IOTs as well as modification of indexes for IOTs');
  insert into tpack_function_names values('kcb kcbb kcbk kcbl kcbs kcbt kcbw kcbz', 'cache manages', 'Oracle''s buffer cache operation as well as operations used by capabilities such as direct load, has clusters , etc.');
  insert into tpack_function_names values('kcc kcf', 'rcv',  'manages and coordinates operations on the control file(s)');
  insert into tpack_function_names values('kcit', 'context/trigger', 'internal trigger functionality');
  insert into tpack_function_names values('kck', 'rcv', 'compatibility related checks associated with the compatible parameter');
  insert into tpack_function_names values('kcl', 'cache', 'background lck process which manages locking in a RAC or parallel server multiple instance environment');
  insert into tpack_function_names values('kco kcq kcra kcrf kcrfr kcrfw kcrp kcrr kcs kct kcv', 'rcv', 'various buffer cache operation such as quiesce operation , managing fast start IO target, parallel recovery operation , etc.');  
  insert into tpack_function_names values('kd', 'ram/data', 'support for row level dependency checking and some log miner operations');
  insert into tpack_function_names values('kda', 'ram/analyze', 'manages the analyze command and collection of statistics');
  insert into tpack_function_names values('kdbl kdc kdd', 'ram/data', 'support for direct load operation, cluster space management and deleting rows');
  insert into tpack_function_names values('kdg', 'ram/analyze', 'gathers information about the underlying data and is used by the analyze command');
  insert into tpack_function_names values('kdi kdibc3 kdibco kdibh kdibl kdibo kdibq kdibr kdic kdici kdii kdil kdir kdis kdiss kdit kdk', 'ram/index', 'support of the creation of indexes on tables an IOTs and index look up');
  insert into tpack_function_names values('kdl kdlt', 'ram/object', 'lob and temporary lob management');
  insert into tpack_function_names values('kdo', 'ram/data', 'operations on data such as inserting a row piece or deleting a row piece');
  insert into tpack_function_names values('kdrp', 'ram/analyze', 'underlying support for operations provided by the dbms_repair package');
  insert into tpack_function_names values('kds kdt kdu', 'ram/data', 'operations on data such as retrieving a row and updating existing row data');
  insert into tpack_function_names values('kdv kdx', 'ram/index', 'functionality for dumping index and managing index blocks');
  insert into tpack_function_names values('kfc kfd kfg', 'asm', 'support for ASM file and disk operations');
  insert into tpack_function_names values('kfh kfp kft', 'rcv', 'support for writing to file header and transportable tablespace operations');
  insert into tpack_function_names values('kgaj kgam kgan kgas kgat kgav kgaz', 'argusdbg/argusdbg', 'support for Java Debug Wire Protocol (JDWP) and debugging facilites');
  insert into tpack_function_names values('kgbt kgg kgh kghs kghx kgkp', 'vos', 'kgbt - support for BTree operations; kgg - generic lists processing; kgh - Heap Manager   managing the internal structures withing the SGA / UGA / PGA and ensures their integrity; kghs - Heap manager with Stream support; kghx - fixed sized shared memory manager; kgkp - generic services scheduling policies');
  insert into tpack_function_names values('kgi', 'dict/libcache', 'instantiate library cache object');
  insert into tpack_function_names values('kgl kgl2 kgl3 kgla kglp kglr kgls', 'dict/libcache', 'generic library cache operation');
  insert into tpack_function_names values('kgm kgmt', 'ilms', 'support for inter language method services or calling one language from another'); 
  insert into tpack_function_names values('kgrq kgsk kgski kgsn kgss', 'vos', 'support for priority queue and scheduling; capabilities for Numa support;  Service State object manager');
  insert into tpack_function_names values('kgupa kgupb kgupd0 kgupf kgupg kgupi kgupl kgupm kgupp kgupt kgupx kguq2 kguu', 'vos', 'Service related activities activities associated with for Process monitor (PMON); spawning or creating of background processes; debugging; managing process address space;  managing the background processes; etc.');
  insert into tpack_function_names values('kgxp', 'vos', 'inter process communication related functions');
  insert into tpack_function_names values('kjak kjat kjb kjbl kjbm kjbr kjcc kjcs kjctc kjcts kjcv kjdd kjdm kjdr kjdx kjfc kjfm kjfs kjfz kjg kji kjl kjm kjp kjr kjs kjt kju kjx', 'ccl/dlm', 'dlm related functionality ; associated with RAC or parallel server operation');
  insert into tpack_function_names values('kjxgf kjxgg kjxgm kjxgn kjxgna kjxgr', 'ccl/cgs', 'provides communication and synchronisation associated with GMS or OPS related functionality as well as name service and OPS Instance Membership Recovery Facility');
  insert into tpack_function_names values('kjxt', 'ccl/dlm', 'DLM request message management');
  insert into tpack_function_names values('kjzc kjzd kjzf kjzg kjzm', 'ccl/diag', 'support for diagnosibility amongst OPS related services');
  insert into tpack_function_names values('kkb', 'dict/sqlddl', 'support for operatoins which load/change table definitions');
  insert into tpack_function_names values('kkbl kkbn kkbo', 'objsupp/objddl', 'support for tables with lobs , nested tables and varrays as well as columns with objects');
  insert into tpack_function_names values('kkdc kkdl kkdo', 'dict/dictlkup', 'support for constraints, dictionary lookup and dictionary support for objects');
  insert into tpack_function_names values('kke', 'optim/cbo', 'query engine cost engine; provides support functions that provide cost estimates for queries under a number of different circumstances');
  insert into tpack_function_names values('kkfd', 'sqlexec/pq', 'support for performing parallel query operation');
  insert into tpack_function_names values('kkfi', 'optim/cbo', 'optimizer support for matching of expressions against functional indexes');
  insert into tpack_function_names values('kkfr kkfs', 'sqlexec/pq', 'support for rowid range handling as well as for building parallel query query operations');
  insert into tpack_function_names values('kkj', 'jobqs/jobq', 'job queue operation');
  insert into tpack_function_names values('kkkd kkki', 'dict/dbsched', 'resource manager related support. Additionally, provides underlying functions provided by dbms_resource_manager and dbms_resource_manager_privs packages');
  insert into tpack_function_names values('kklr', 'dict/sqlddl', 'provides functions used to manipulate LOGGING and/or RECOVERABLE attributes of an object (non-partitioned table or index or partitions of a partitioned table or index)');
  insert into tpack_function_names values('kkm kkmi', 'dict/dictlkup',  'provides various semantic checking functions');
  insert into tpack_function_names values('kkn', 'ram/analyze', 'support for the analyze command');
  insert into tpack_function_names values('kko kkocri', 'optim/cbo', 'Cost based Optimizer operation  generates alternative execution plans in order to find the optimal / quickest access to the data. Also , support to determine cost and applicability of scanning a given index in trying to create or rebuild an index or a partition thereof');
  insert into tpack_function_names values('kkpam kkpap', 'ram/partnmap', 'support for mapping predicate keys expressions to equivalent partitions');
  insert into tpack_function_names values('kkpo kkpoc kkpod', 'dict/partn', 'support for creation and modification of partitioned objects'); 
  insert into tpack_function_names values('kkqg kkqs kkqs1 kkqs2 kkqs3 kkqu kkqv kkqw', 'optim/vwsubq', 'query rewrite operation'); 
  insert into tpack_function_names values('kks kksa kksh kksl kksm', 'dict/shrdcurs', 'support for managing shared cursors/ shared sql');
  insert into tpack_function_names values('kkslc', 'dict/shrdcurs', 'handling literal values while parsing');
  insert into tpack_function_names values('kkt', 'dict/sqlddl', 'support for creating, altering and dropping trigger definitions as well as handling the trigger operation');
  insert into tpack_function_names values('kkxa', 'repl/defrdrpc', 'underlying support for dbms_defer_query package operations');
  insert into tpack_function_names values('kkxb', 'dict/sqlddl', 'library cache interface for external tables');
  insert into tpack_function_names values('kkxl', 'dict/plsicds', 'underlying support for the dbms_lob package');
  insert into tpack_function_names values('kkxm', 'progint/opi', 'support for inter language method services');
  insert into tpack_function_names values('kkxs', 'dict/plsicds', 'underlying support for the dbms_sys_sql package');
  insert into tpack_function_names values('kkxt', 'repl/trigger', 'support for replication internal trigger operation');
  insert into tpack_function_names values('kkxwtp', 'progint/opi', 'entry point into the plsql compiler');
  insert into tpack_function_names values('kky', 'drv', 'support for alter system/session commands');
  insert into tpack_function_names values('kkz kkzd kkzf kkzg kkzi kkzj kkzl kkzo kkzp kkzq kkzr kkzu kkzv', 'repl/snapshot', 'support for snapshots or Materialized View validation and operation');
  insert into tpack_function_names values('kla klc klcli klx', 'tools/sqlldr', 'support for direct path sql loader operation');
  insert into tpack_function_names values('kmc kmcp kmd kmm kmr', 'mts/mts', 'support for Multi Threaded server operation (MTS)  manange and operate the virtual circuit mechanism, handle the dispatching of massages, administer shared servers and for collecting and maintaining statistics associated with MTS');
  insert into tpack_function_names values('knac knafh knaha knahc knahf knahs', 'repl/apply', 'replication apply operation associated with Oracle streams');
  insert into tpack_function_names values('kncc', 'repl/repcache', 'support for replication related information stored and maintained in library cache');
  insert into tpack_function_names values('kncd knce', 'repl/defrdrpc', 'replication related enqueue and dequeue of transction data as well as other queue related operations');
  insert into tpack_function_names values('kncog', 'repl/repcache', 'support for loading replicaiton object group information into library cache');
  insert into tpack_function_names values('kni', 'repl/trigger', 'support for replication internal trigger operation');
  insert into tpack_function_names values('knip knip2 knipi knipl knipr knipu knipu2 knipx', 'repl/intpkg', 'support for replication internal package operation.');
  insert into tpack_function_names values('kno', 'repl/repobj', 'support for replication objects');
  insert into tpack_function_names values('knp knpc knpcb knpcd knpqc knps', 'repl/defrdrpc', 'operations assocaied with propagating transactions to a remote node and coordination of this activity.');
  insert into tpack_function_names values('knst', 'repl/stats', 'replication statistics collection');
  insert into tpack_function_names values('knt kntg kntx', 'repl/trigger', 'support for replication internal trigger operation');
  insert into tpack_function_names values('koc', 'objmgmt/objcache', 'support for managing ADTs objects in the OOCI heap');
  insert into tpack_function_names values('kod', 'objmgmt/datamgr', 'support for persistent storage for objects  for read/write objects, to manage object IDs, and to manage object concurrency and recovery.');
  insert into tpack_function_names values('koh', 'objmgmt/objcache', 'object heap manager provides memory allocation services for objects');
  insert into tpack_function_names values('koi', 'objmgmt/objmgr', 'support for object types');
  insert into tpack_function_names values('koka', 'objsupp/objdata', 'support for reading images, inserting images, updating images, and deleting images based on object references (REFs).');
  insert into tpack_function_names values('kokb kokb2', 'objsupp/objsql', 'support for nested table objects');
  insert into tpack_function_names values('kokc', 'objmgmt/objcache', 'support for pinning , unpinning and freeing objects');
  insert into tpack_function_names values('kokd', 'objsupp/datadrv', 'driver on the server side for managing objects');
  insert into tpack_function_names values('koke koke2 koki', 'objsupp/objsql', 'support for managing objects');
  insert into tpack_function_names values('kokl', 'objsupp/objdata', 'lob access');
  insert into tpack_function_names values('kokl2', 'objsupp/objsql', 'lob DML and programmatic interface support');
  insert into tpack_function_names values('kokl3', 'objsupp/objdata', 'object temporary LOB support');
  insert into tpack_function_names values('kokle kokm', 'objsupp/objsql', 'object SQL evaluation functions');
  insert into tpack_function_names values('kokn', 'objsupp/objname', 'naming support for objects');
  insert into tpack_function_names values('koko', 'objsupp/objsup', 'support functions to allow oci/rpi to communicate with Object Management Subsystem (OMS).');
  insert into tpack_function_names values('kokq koks koks2 koks3 koksr', 'objsupp/objsql', 'query optimisation for objects , semantic checking and semantic rewrite operations');
  insert into tpack_function_names values('kokt kokt2 kokt3', 'objsupp/objddl', 'object compilation type manager');
  insert into tpack_function_names values('koku kokv', 'objsupp/objsql', 'support for unparse object operators and object view support');
  insert into tpack_function_names values('kol kolb kole kolf kolo', 'objmgmt/objmgr', 'support for object Lob buffering , object lob evaluation and object Language/runtime functions for Opaque types');
  insert into tpack_function_names values('kope2 kopi2 kopo kopp2 kopu koputil kopz', 'objmgmt/pickler', '8.1 engine implementation, implementation of image ops for 8.1+ image format together with various pickler related support functions');
  insert into tpack_function_names values('kos', 'objsupp/objsup', 'object Stream interfaces for images/objects');
  insert into tpack_function_names values('kot kot2 kotg', 'objmgmt/typemgr', 'support for dynamic type operations to create, delete, and update types.');
  insert into tpack_function_names values('koxs koxx', 'objmgmt/objmgt', 'object generic image Stream routines and miscellaneous generic object functions');
  insert into tpack_function_names values('kpcp kpcxlt', 'progint/kpc', 'Kernel programmatic connection pooling and kernel programmatic common type XLT translation routines');
  insert into tpack_function_names values('kpki', 'progint/kpki', 'kernel programatic interface support');
  insert into tpack_function_names values('kpls', 'cartserv/corecs', 'support for string formatting operations');
  insert into tpack_function_names values('kpn', 'progint/kpn', 'support for server to server communication');
  insert into tpack_function_names values('kpoal8 kpoaq kpob kpodny kpodp kpods kpokgt kpolob kpolon kpon', 'progint/kpo', 'support for programmatic operations');
  insert into tpack_function_names values('kpor', 'progint/opi', 'support for streaming protocol used by replication');
  insert into tpack_function_names values('kposc', 'progint/kpo', 'support for scrollable cursors');
  insert into tpack_function_names values('kpotc', 'progint/opi', 'oracle side support functions for setting up trusted external procedure callbacks');
  insert into tpack_function_names values('kpotx kpov', 'progint/kpo', 'support for managing local and distributed transaction coordination.');
  insert into tpack_function_names values('kpp2 kpp3', 'sqllang/parse', 'kpp2 - parse routines for dimensions; kpp3 - parse support for create/alter/drop summary statements');
  insert into tpack_function_names values('kprb kprc', 'progint/rpi', 'support for executing sql efficiently on the Oracle server side as well as for copying data types during rpi operations');
  insert into tpack_function_names values('kptsc', 'progint/twotask', 'callback functions provided to all streaming operation as part of replication functionality');
  insert into tpack_function_names values('kpu kpuc kpucp', 'progint/kpu', 'Oracle kernel side programmatic user interface, cursor management functions and client side connection pooling support');
  insert into tpack_function_names values('kqan kqap kqas', 'argusdbg/argusdbg', 'server-side notifiers and callbacks for debug operations.');
  insert into tpack_function_names values('kql kqld kqlp', 'dict/libcache', 'SQL Library Cache manager - manages the sharing of sql statements in the shared pool');
  insert into tpack_function_names values('kqr', 'dict/rowcache', 'row cache management. The row cache consists of a set of facilities to provide fast access to table definitions and locking capabilities.');
  insert into tpack_function_names values('krbi krbx krby krcr krd krpi', 'rcv', 'Backup and recovery related operations. krbi - dbms_backup_restore package underlying support. krbx - proxy copy controller. krby - image copy. krcr - Recovery Controlfile Redo. krd - Recover Datafiles (Media and Standby Recovery). krpi - support for the package  dbms_pitr.');
  insert into tpack_function_names values('krvg krvt', 'rcv/vwr', 'krvg - support for generation of redo associated with DDL; krvt - support for redo log miner viewer (also known as log miner)');
  insert into tpack_function_names values('ksa ksdp ksdx kse ksfd ksfh ksfq ksfv ksi ksim ksk ksl ksm ksmd ksmg ksn ksp kspt ksq ksr kss ksst ksu ksut', 'vos', 'support for various kernel associated capabilities');
  insert into tpack_function_names values('ksx', 'sqlexec/execsvc', 'support for query execution associated with temporary tables');
  insert into tpack_function_names values('ksxa ksxp ksxr', 'vos', 'support for various kernel associated capabilities in relation to OPS or RAC operation');
  insert into tpack_function_names values('kta', 'space/spcmgmt', 'support for DML locks and temporary tables associated with table access');
  insert into tpack_function_names values('ktb ktbt ktc', 'txn/lcltx', 'transaction control operations at the block level  locking block, allocating space within the block , freeing up space, etc.');
  insert into tpack_function_names values('ktec ktef ktehw ktein ktel kteop kteu', 'space/spcmgmt', 'support for extent management operations. ktec - extent concurrency operations. ktef - extent format. ktehw - extent high water mark operations. ktein - extent information operations. ktel - extent support for sql loader. kteop - extent operations  add extent to segment, delete extent, resize extent, etc. kteu - redo support for operations changing segment header / extent map');
  insert into tpack_function_names values('ktf', 'txn/lcltx', 'flashback support');
  insert into tpack_function_names values('ktfb ktfd ktft ktm', 'space/spcmgmt', 'ktfb - support for bitmapped space manipulation of files/tablespaces; ktfd - dictionary-based extent management; ktft - support for temporary file manipulation; ktm - SMON operation');
  insert into tpack_function_names values('ktp ktpr ktr ktri', 'txn/lcltx', 'ktp - support for parallel transaction operation; ktpr - support for parallel transaction recovery; ktr - kernel transaction read consistency; ktri - support for dbms_resumable package');
  insert into tpack_function_names values('ktsa ktsap ktsau ktsb ktscbr ktsf ktsfx ktsi ktsm ktsp ktss ktst ktsx ktt kttm', 'space/spcmgmt', 'support for checking and verifying space usage');
  insert into tpack_function_names values('ktu ktuc ktur ktusm', 'txn/lcltx', 'internal management of undo and rollback segments');
  insert into tpack_function_names values('kwqa kwqi kwqic kwqid kwqie kwqit kwqj kwqm kwqn kwqo kwqp kwqs kwqu kwqx', 'oltp/qs', 'support for advanced queuing; kwqa - advanced queue administration; kwqi - support for AQ PL/SQL trusted callouts; kwqic - common AQ support functions; kwqid - AQ dequeue support; kwqie - AQ enqueu support; kwqit - time management operation; kwqj - job queue scheduler for propagation; kwqm - Multiconsumer queue IOT support; kwqn - queue notifier; kwqozz - AQ support for checking instType checking options; kwqp - queueing propagation; kwqs - statistics handling; kwqu - handles lob data; kwqx - support for handling transformation');
  insert into tpack_function_names values('kwrc kwre', 'oltp/re', 'rules engine evaluation');
  insert into tpack_function_names values('kxcc kxcd kxcs', 'sqllang/integ', 'constraint processing');
  insert into tpack_function_names values('kxdr', 'sqlexec/dmldrv', 'DML driver entrypoint');
  insert into tpack_function_names values('kxfp kxfpb kxfq kxfr kxfx', 'sqlexec/pq', 'parallel query support');
  insert into tpack_function_names values('kxhf kxib', 'sqlexec/execsvc', 'khhf- support for hash join file and memory management; kxib - index buffering operations');
  insert into tpack_function_names values('kxs', 'dict/instmgmt', 'support for executing shared cursors');
  insert into tpack_function_names values('kxti kxto kxtr', 'dbproc/trigger', 'support for trigger operation');
  insert into tpack_function_names values('kxtt', 'ram/partnmap', 'support for temporary table operations');
  insert into tpack_function_names values('kxwph', 'ram/data', 'support for managing attributes of the segment of a table / cluster / table-partition');
  insert into tpack_function_names values('kza', 'security/audit', 'support for auditing operations');
  insert into tpack_function_names values('kzar', 'security/dac', 'support for application auditing');
  insert into tpack_function_names values('kzck', 'security/crypto', 'encryption support');
  insert into tpack_function_names values('kzd', 'security/dac', 'support for dictionary access by security related functions');
  insert into tpack_function_names values('kzec', 'security/dbencryption', 'support inserting and retrieving encrypted objects into and out of the database');
  insert into tpack_function_names values('kzfa kzft', 'security/audit', 'support for fine grained auditing');
  insert into tpack_function_names values('kzia', 'security/logon', 'identification and authentication operations');
  insert into tpack_function_names values('kzp kzra kzrt kzs kzu kzup', 'security/dac', 'security related operations associated with privileges');
  insert into tpack_function_names values('msqima msqimb', 'sqlexec/sqlgen', 'support for generating sql statments');
  insert into tpack_function_names values('ncodef npi npil npixfr', 'progint/npi', 'support for managing remote network connection from within the server itself');
  insert into tpack_function_names values('oba', 'sqllang/outbufal', 'operator buffer allocate for various types of operators  concatenate, decode, NVL, etc. the list is extensive.');
  insert into tpack_function_names values('ocik', 'progint/oci', 'OCI oracle server functions');
  insert into tpack_function_names values('opiaba opidrv opidsa opidsc opidsi opiexe opifch opiino opilng opipar opipls opirip opitsk opix', 'progint/opi', 'OPI Oracle server functions - these are at the top of the server stack and are called indirectly by ythe client in order to server the client request.');
  insert into tpack_function_names values('orlr', 'objmgmt/objmgr', 'support for C langauge interfaces to user-defined types (UDTs)');
  insert into tpack_function_names values('orp', 'objmgmt/pickler', 'oracle''s external pickler / opaque type interfaces');
  insert into tpack_function_names values('pesblt pfri pfrsqc', 'plsql/cox', 'pesblt - pl/sql built in interpreter; pfri - pl/sql runtime; pfrsqc - pl/sql callbacks for array sql and dml with returning');
  insert into tpack_function_names values('piht', 'plsql/gen/utl', 'support for pl/sql implementation of utl_http package');
  insert into tpack_function_names values('pirg', 'plsql/cli/utl_raw', 'support for pl/sql implementation of utl_raw package');
  insert into tpack_function_names values('pism', 'plsql/cli/utl_smtp', 'support for pl/sql implementation of utl_smtp package');
  insert into tpack_function_names values('pitcb', 'plsql/cli/utl_tcp', 'support for pl/sql implementation of utl_tcp package');
  insert into tpack_function_names values('piur', 'plsql/gen/utl_url', 'support for pl/sql implementation of utl_url package');
  insert into tpack_function_names values('plio', 'plsql/pkg pl/sql', 'object instantiation');
  insert into tpack_function_names values('plslm', 'plsql/cox', 'support for NCOMP processing');
  insert into tpack_function_names values('plsm pmuc pmuo pmux', 'objmgmt/pol', 'support for pl/sql handling of collections');
  insert into tpack_function_names values('prifold priold', 'plsql/cox', 'support to allow rpc forwarding to an older release');
  insert into tpack_function_names values('prm', 'sqllang/param parameter', 'handling associated with sql layer');
  insert into tpack_function_names values('prsa prsc prssz', 'sqllang/parse', 'prsa - parser for alter cluster command; prsc - parser for create database command; prssz - support for parse context to be saved');
  insert into tpack_function_names values('psdbnd psdevn', 'progint/dbpsd', 'psdbnd - support for managing bind variables; psdevn - support for pl/sql debugger');
  insert into tpack_function_names values('psdicd', 'progint/plsicds', 'small number of ICD to allow pl/sql to call into C source');
  insert into tpack_function_names values('psdmsc psdpgi', 'progint/dbpsd', 'psdmsc - pl/sql system dependent miscellaneous functions ; psdpgi - support for opening and closing cursors in pl/sql');
  insert into tpack_function_names values('psf', 'plsql/pls', 'pl/sql service related functions for instantiating called pl/sql unit in library cache');
  insert into tpack_function_names values('qbadrv qbaopn', 'sqllang/qrybufal', 'provides allocation of buffer and control structures in query execution');
  insert into tpack_function_names values('qcdl qcdo', 'dict/dictlkup', 'qcdl - query compile semantic analysis; qcdo - query compile dictionary support for objects');
  insert into tpack_function_names values('qci', 'dict/shrdcurs', 'support for SQL language parser and semantic analyser');
  insert into tpack_function_names values('qcop qcpi qcpi3 qcpi4 qcpi5', 'sqllang/parse', 'support for query compilation parse phase');
  insert into tpack_function_names values('qcs qcs2 qcs3 qcsji qcso', 'dict/dictlkup', 'support for semantic analysis by SQL compiler');
  insert into tpack_function_names values('qct qcto', 'sqllang/typeconv', 'qct - query compile type check operations; qcto - query compile type check operators');
  insert into tpack_function_names values('qcu', 'sqllang/parse', 'various utilities provided for sql compilation');
  insert into tpack_function_names values('qecdrv', 'sqllang/qryedchk', 'driver performing high level checks on sql language query capabilities');
  insert into tpack_function_names values('qerae', 'sqlexec/rowsrc', 'row source (And-Equal) implementation');
  insert into tpack_function_names values('qerba', 'sqlexec/rowsrc', 'Bitmap Index AND row source');
  insert into tpack_function_names values('qerbc', 'sqlexec/rowsrc', 'bitmap index compaction row source');
  insert into tpack_function_names values('qerbi', 'sqlexec/rowsrc', 'bitmap index creation row source');
  insert into tpack_function_names values('qerbm', 'sqlexec/rowsrc', 'QERB Minus row source');
  insert into tpack_function_names values('qerbo', 'sqlexec/rowsrc', 'Bitmap Index OR row source');
  insert into tpack_function_names values('qerbt', 'sqlexec/rowsrc', 'bitmap convert row source');
  insert into tpack_function_names values('qerbu', 'sqlexec/rowsrc', 'Bitmap Index Unlimited-OR row source');
  insert into tpack_function_names values('qerbx', 'sqlexec/rowsrc', 'bitmap index access row source');
  insert into tpack_function_names values('qercb', 'sqlexec/rowsrc', 'row source connect by');
  insert into tpack_function_names values('qercb', 'sqlexec/rowsrc', 'support for connect by');
  insert into tpack_function_names values('qerco', 'sqlexec/rowsrc', 'count row source');
  insert into tpack_function_names values('qerdl', 'sqlexec/rowsrc', 'row source delete');
  insert into tpack_function_names values('qerep', 'sqlexec/rowsrc', 'explosion row source');
  insert into tpack_function_names values('qerff', 'sqlexec/rowsrc', 'row source fifo buffer');
  insert into tpack_function_names values('qerfi', 'sqlexec/rowsrc', 'first row row source');
  insert into tpack_function_names values('qerfl', 'sqlexec/rowsrc', 'filter row source definition');
  insert into tpack_function_names values('qerfu', 'sqlexec/rowsrc', 'row source for update');
  insert into tpack_function_names values('qerfx', 'sqlexec/rowsrc', 'fixed table row source');
  insert into tpack_function_names values('qergi', 'sqlexec/rowsrc', 'granule iterator row source');
  insert into tpack_function_names values('qergr', 'sqlexec/rowsrc', 'group by rollup row source');
  insert into tpack_function_names values('qergs', 'sqlexec/rowsrc', 'group by sort row source');
  insert into tpack_function_names values('qerhc', 'sqlexec/rowsrc', 'row sources hash clusters');
  insert into tpack_function_names values('qerhj', 'sqlexec/rowsrc', 'row source Hash Join');
  insert into tpack_function_names values('qeril', 'sqlexec/rowsrc', 'In-list row source');
  insert into tpack_function_names values('qerim', 'sqlexec/rowsrc', 'Index Maintenance row source');
  insert into tpack_function_names values('qerix', 'sqlexec/rowsrc', 'Index row source');
  insert into tpack_function_names values('qerjo', 'sqlexec/rowsrc', 'row source join');
  insert into tpack_function_names values('qerle', 'sqlexec/rowsrc', 'linear execution row source implementation');
  insert into tpack_function_names values('qerli', 'sqlexec/rowsrc', 'parallel create index');
  insert into tpack_function_names values('qerlt', 'sqlexec/rowsrc', 'row source populate Table');
  insert into tpack_function_names values('qerns', 'sqlexec/rowsrc', 'group by No Sort row source');
  insert into tpack_function_names values('qeroc', 'sqlexec/rowsrc', 'object collection iterator row source');
  insert into tpack_function_names values('qeroi', 'sqlexec/rowsrc', 'extensible indexing query component');
  insert into tpack_function_names values('qerpa', 'sqlexec/rowsrc', 'partition row sources');
  insert into tpack_function_names values('qerpf', 'sqlexec/rowsrc', 'query execution row source prefetch');
  insert into tpack_function_names values('qerpx', 'sqlexec/rowsrc', 'row source parallelizer');
  insert into tpack_function_names values('qerrm', 'sqlexec/rowsrc', 'remote row source');
  insert into tpack_function_names values('qerse', 'sqlexec/rowsrc', 'row source set implementation');
  insert into tpack_function_names values('qerso', 'sqlexec/rowsrc', 'sort row source');
  insert into tpack_function_names values('qersq', 'sqlexec/rowsrc', 'row source for sequence number');
  insert into tpack_function_names values('qerst', 'sqlexec/rowsrc', 'query execution row sources statistics');
  insert into tpack_function_names values('qertb', 'sqlexec/rowsrc', 'table row source');
  insert into tpack_function_names values('qertq', 'sqlexec/rowsrc', 'table queue row source');
  insert into tpack_function_names values('qerua', 'sqlexec/rowsrc', 'row source  union-All;');
  insert into tpack_function_names values('qerup', 'sqlexec/rowsrc', 'update row source');
  insert into tpack_function_names values('qerus', 'sqlexec/rowsrc', 'upsert row source');
  insert into tpack_function_names values('qervw', 'sqlexec/rowsrc', 'view row source');
  insert into tpack_function_names values('qerwn', 'sqlexec/rowsrc', 'WINDOW row source');
  insert into tpack_function_names values('qerxt', 'sqlexec/rowsrc', 'external table fetch row source');
  insert into tpack_function_names values('qes3t qesa qesji qesl qesmm qesmmc', 'sqlexec/execsvc', 'run time support for sql execution');
  insert into tpack_function_names values('qkacon qkadrv qkajoi qkatab qke qkk qkn qkna qkne', 'sqlexec/rwsalloc', 'SQL query dynamic structure allocation routines');
  insert into tpack_function_names values('qks3t', 'sqlexec/execsvc', 'query execution service associated with temp table transformation');
  insert into tpack_function_names values('qksmm qksmms qksop', 'sqllang/compsvc', 'qksmm - memory management services for the SQL compiler; qksmms - memory management simulation services for the SQL compiler; qksop - query compilation service for operand processing');
  insert into tpack_function_names values('qkswc', 'sqlexec/execsvc', 'support for temp table transformation associated for with clause.');
  insert into tpack_function_names values('qmf', 'xmlsupp/util', 'support for ftp server; implements processing of ftp commands');
  insert into tpack_function_names values('qmr qmrb qmrs', 'xmlsupp/resolver', 'support hierarchical resolver');
  insert into tpack_function_names values('qms', 'xmlsupp/data', 'support for storage and retrieval of XOBs');
  insert into tpack_function_names values('qmurs', 'xmlsupp/uri', 'support for handling URIs');
  insert into tpack_function_names values('qmx qmxsax', 'xmlsupp/data', 'qmx - xml support; qmxsax - support for handling sax processing');
  insert into tpack_function_names values('qmxtc', 'xmlsupp/sqlsupp', 'support for ddl and other operators related to the sql XML support');
  insert into tpack_function_names values('qmxtgx', 'xmlsupp', 'support for transformation  ADT -> XML');
  insert into tpack_function_names values('qmxtsk', 'xmlsupp/sqlsupp', 'XMLType support functions');
  insert into tpack_function_names values('qsme', 'summgmt/dict', 'summary management expression processing');
  insert into tpack_function_names values('qsmka qsmkz', 'dict/dictlkup', 'qsmka - support to analyze request in order to determine whether a summary could be created that would be useful; qsmkz - support for create/alter summary semantic analysis');
  insert into tpack_function_names values('qsmp qsmq qsmqcsm qsmqutl', 'summgmt/dict', 'qsmp - summary management partition processing; qsmq - summary management dictionary access; qsmqcsm - support for create / drop / alter summary and related dimension operations; qsmqutl - support for summaries');
  insert into tpack_function_names values('qsms', 'summgmt/advsvr', 'summary management advisor');
  insert into tpack_function_names values('qxdid', 'objsupp/objddl', 'support for domain index ddl operations');
  insert into tpack_function_names values('qxidm', 'objsupp/objsql', 'support for extensible index dml operations');
  insert into tpack_function_names values('qxidp', 'objsupp/objddl', 'support for domain index ddl partition operations');
  insert into tpack_function_names values('qxim', 'objsupp/objsql', 'extensible indexing support for objects');
  insert into tpack_function_names values('qxitex qxopc qxope', 'objsupp/objddl', 'qxitex - support for create / drop indextype; qxope - execution time support for operator callbacks; qxope - execution time support for operator DDL');
  insert into tpack_function_names values('qxopq qxuag qxxm', 'objsupp/objsql', 'qxopq - support for queries with user-defined operators; qxuag - support for user defined aggregate processing; qxxm - queries involving external tables');
  insert into tpack_function_names values('rfmon rfra rfrdb rfrla rfrm rfrxpt', 'drs', 'implements 9i data guard broker monitor');
  insert into tpack_function_names values('rnm', 'dict/sqlddl', 'manages rename statement operation');
  insert into tpack_function_names values('rpi', 'progint/rpi', 'recursive procedure interface which handles the the environment setup where multiple recursize statements are executed from one top level statement');
  insert into tpack_function_names values('rwoima', 'sqlexec/rwoprnds', 'row operand operations');
  insert into tpack_function_names values('rwsima', 'sqlexec/rowsrc', 'row source implementation/retrieval according to the defining query');
  insert into tpack_function_names values('sdbima', 'sqlexec/sort', 'manages and performs sort operation');
  insert into tpack_function_names values('selexe', 'sqlexec/dmldrv', 'handles the operation of select statement execution');
  insert into tpack_function_names values('skgm', 'osds', 'platform specific memory management rountines interfacing with O.S. allocation functions');
  insert into tpack_function_names values('smbima sor', 'sqlexec/sort', 'manages and performs sort operation');
  insert into tpack_function_names values('sqn', 'dict/sqlddl', 'support for parsing references to sequences');
  insert into tpack_function_names values('srdima srsima stsima', 'sqlexec/sort', 'manages and performs sort operation');
  insert into tpack_function_names values('tbsdrv', 'space/spcmgmt', 'operations for executing create / alter / drop tablespace and related supporting functions');
  insert into tpack_function_names values('ttcclr ttcdrv ttcdty ttcrxh ttcx2y', 'progint/twotask', 'two task common layer which provides high level interaction and negotiation functions for Oracle client when communicating with the server. It also provides important function of converting client side data / data types into equivalent on the server and vice versa');
  insert into tpack_function_names values('uixexe ujiexe updexe upsexe', 'sqlexec/dmldrv', 'support for  index maintenance operations, the execution of the update statement and associated actions connected with update as well as the upsert command which combines the operations of update and insert');
  insert into tpack_function_names values('vop', 'optim/vwsubq', 'view optimisation related functionality');
  insert into tpack_function_names values('xct', 'txn/lcltx', 'support for the management of transactions and savepoint operations');
  insert into tpack_function_names values('xpl', 'sqlexec/expplan', 'support for the explain plan command');
  insert into tpack_function_names values('xty', 'sqllang/typeconv', 'type checking functions');
  insert into tpack_function_names values('zlke', 'security/ols/intext', 'label security error handling component');
  
  -- add additional function name infos.
  insert into tpack_function_names values('pevm plsql', 'pl/sql', 'pl/sql related operations');
  
  insert into tpack_function_names values('ksmlgpalloc', '-', 'ksm large pool allocation');
  insert into tpack_function_names values('ksfqxcre', '-', 'create KSFQ context');
  insert into tpack_function_names values('krbbpc', '-', 'backup piece create');
  insert into tpack_function_names values('krbibpc', '-', 'implemenation backup piece create');
  insert into tpack_function_names values('kporpc', '-', 'The oracle side function to start ');
  insert into tpack_function_names values('opiodr', '-', 'Oracle code request driver - route the current request');
  insert into tpack_function_names values('ttcpip', '-', 'two task common pipe read/write');
  insert into tpack_function_names values('opiino', '-', 'oracle program interface initialize opi');
  insert into tpack_function_names values('kghnospc', '-', 'KGH: There is no space available in the heap, signal the error');
  insert into tpack_function_names values('ksmasg', '-', 'callback functions for allocating an SGA extent. The SGA is fixed size');
  insert into tpack_function_names values('kghalo', '-', 'KGH: main allocation entry point');
  
  insert into tpack_function_names values('ksedst', '-', 'KSE: dump the call stack');
  insert into tpack_function_names values('ksedmp', '-', 'KSE: dump the process state');
  insert into tpack_function_names values('kgeadse', '-', 'KGE ADd String Internal Error onto the error');
  insert into tpack_function_names values('kgerinv', '-', 'KGE Record Internal (Named) error (with  Va_list)');
  insert into tpack_function_names values('kglget', '-', 'KGL: GET a lock on an object');
  insert into tpack_function_names values('kglgob', '-', 'KGL: GeT an Object locked and pinned');
  insert into tpack_function_names values('kgiind', '-', 'KGI: INstantiate a Dependency (depended-on) object');
  insert into tpack_function_names values('pfrrun', '-', 'PSDEVN: PL/SQL Interpreter Main Instruction Loop');
  insert into tpack_function_names values('plsql_run', '-', 'single entry point for top level pfrrun and penrun');
  insert into tpack_function_names values('peicnt', '-', 'PL/SQL controlled Execution');
  insert into tpack_function_names values('kkxexe', '-', 'KKX: execute plsql');
  
  insert into tpack_function_names values('pevm_EXIM', '-', 'PL/SQL execute immediate');
  insert into tpack_function_names values('EXIM', '-', 'PL/SQL execute immediate');
  
  insert into tpack_function_names values('ksf', '-', 'file related operations');
  insert into tpack_function_names values('kziasfc', '-', 'set the FAILED_LOGIN_COUNT parameter of the user');
  insert into tpack_function_names values('ktsucu', '-', 'insert, update, delete from user$');
  
  insert into tpack_function_names values('kglalp', '-', 'KGL: allocate memory function');
  insert into tpack_function_names values('kgghteGrowHashTable', '-', 'KGL: allocate memory for a hash table');
  
  insert into tpack_function_names values('qm_', '-', 'XDB related operations');
  
  insert into tpack_function_names values('kes', '-', 'SQL tuning advisor related operations');
  
  insert into tpack_function_names values('kglfall', '-', 'KGL: free all');
  insert into tpack_function_names values('kglfrunp', '-', 'KGL: free unpinned list');
  
  insert into tpack_function_names values('kmg', '-', 'dynamic SGA resize related operations');
  
  insert into tpack_function_names values('ksfdwtio ksfdaio1', '-', 'asynch I/O related operations');
  
  insert into tpack_function_names values('kzddlk', '-', 'dblink access control related operations');
  
  insert into tpack_function_names values('kgsk', '-', 'resource manager related operations');
  
  commit;
end;
/

-- helper table to show oerr message
-- drop table tpack_oraus purge;
create table tpack_oraus (
  err_code      varchar2(5),
  message       varchar2(1000),
  texts         clob
);

create index tpack_oraus_n1 on tpack_oraus(err_code);
